package com.ywu.data.dict.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.data.dict.standard.dto.DataDictDto;
import com.ywu.data.dict.standard.entity.DataDictEntity;
import com.ywu.data.dict.standard.service.DataDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName DataDictApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/7/6 21:18
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/data/dict")
public class DataDictApi {
    @Autowired
    private DataDictService dataDictService;

    /**
    * @Author GroundDemo
    * @Description 分页查询数据字典列表
    * @Date 21:26 2024/7/6
    * @Param [dataDictDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/data.dict.query.page.list")
    public CommonResult<Object> queryDataDictListByPage(@RequestBody DataDictDto dataDictDto) {
        return dataDictService.queryDataDictListByPage(dataDictDto);
    }

    /**
    * @Author GroundDemo
    * @Description 添加数据字典
    * @Date 21:35 2024/7/6
    * @Param [dataDictDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/data.dict.add.info")
    public CommonResult<Object> addDataDictInfo(@RequestBody DataDictDto dataDictDto) {
        return dataDictService.addDataDictInfo(dataDictDto);
    }

    /**
    * @Author GroundDemo
    * @Description 更新数据字典
    * @Date 21:39 2024/7/6
    * @Param [dataDictDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/data.dict.update.info")
    public CommonResult<Object> updateDataDictInfo(@RequestBody DataDictDto dataDictDto) {
        return dataDictService.updateDataDictInfo(dataDictDto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除数据字典
    * @Date 21:42 2024/7/6
    * @Param [dataDictDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/data.dict.delete.info")
    public CommonResult<Object> deleteDataDictInfo(@RequestBody DataDictDto dataDictDto) {
        return dataDictService.deleteDataDictInfo(dataDictDto);
    }

    /**
    * @Author GroundDemo
    * @Description 更新是否租户共享的状态
    * @Date 9:04 2024/9/21
    * @Param [dataDictDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/data.dict.update.isShare")
    public CommonResult<Object> updateIsShare(@RequestBody DataDictDto dataDictDto) {
        return dataDictService.updateIsShare(dataDictDto);
    }

    /**
     * @Author GroundDemo
     * @Description SPI调用   查询数据字典
     * @Date 21:42 2024/7/6
     * @Param [dataDictDto]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/data.dict.query.for.spi.info")
    public CommonResult<DataDictEntity> queryForSpi(@RequestBody DataDictDto dataDictDto) {
        return dataDictService.queryDataDict(dataDictDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询数据字典
    * @Date 9:11 2024/9/21
    * @Param [dataDictDto]
    * @return com.ywu.common.result.CommonResult<com.ywu.data.dict.standard.entity.DataDictEntity>
    **/
    @PostMapping("/data.dict.query.info")
    public CommonResult<DataDictEntity> queryDataDict(@RequestBody DataDictDto dataDictDto) {
        return dataDictService.queryDataDict(dataDictDto);
    }
}
